package com.ruoyi.cmecomon.service;

import com.ruoyi.cmemetal.domain.ZxPrintProcess;
import com.ruoyi.cmemetal.mapper.ZxPrintProcessMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author Zhang Xu
 * @Date 2022/1/18 22:50
 * @Version 1.0
 */
@Service
public class WorkTimesServiceImpl implements WorkTimesService {

    @Autowired
    private ZxPrintProcessMapper zxPrintProcessMapper;


    /**
     * 获取打印设备运行总时长
     * @return 总时长
     */
    @Override
    public long getPrintTime() {

        List<ZxPrintProcess> list = zxPrintProcessMapper.selectZxPrintProcessList(new ZxPrintProcess());
        int times = 0;
        if(list.size() != 0){
            for (ZxPrintProcess zxPrintProces : list) {
                times += zxPrintProces.getPrintrTime();
            }
        }
        return times;
    }
}
